<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>Insert title here</title>
	<script src="${pageContext.request.contextPath}/js/qrcodejs-master/qrcode.js"></script>
</head>
<body>
	<table align="center" width="60%" cellspacing="80">
		<caption style="font-size: 30px;">二维码展示</caption>
		<tr>
			<th>支付宝二维码</th>
			<th>微信二维码</th>
		</tr>
		<tr align="center">
			<td>
				<div id="aliqrcode"></div>
				<input type="hidden" id="aliCode" name="aliCode" value="12345"/>
			</td>
			<td>
				<div id="wxqrcode"></div>
				<input type="hidden" id="wxCode" name="wxCode" value="${requestScope.codeurl }" />
				<input type="hidden" id="respMsg" name="respMsg" value="${requestScope.respMsg }" />
				<span id="span"></span>
			</td>
		</tr>
	</table>
		
	<script type="text/javascript">
		var aliCode = document.getElementById("aliCode").value;
		var wxCode = document.getElementById("wxCode").value;
		// 设置支付宝参数方式
		var qrcode = new QRCode('aliqrcode', {
		  text: aliCode,
		  width: 256,
		  height: 256,
		  colorDark : '#000000',
		  colorLight : '#ffffff',
		  correctLevel : QRCode.CorrectLevel.H
		});
		
		//如果返回的url不为空
		if(wxCode != '' && wxCode != null) {
			//设置微信参数方式
			var qrcode = new QRCode('wxqrcode', {
				text: wxCode,
				width: 256,
				height: 256,
				colorDark : '#000000',
				colorLight : '#ffffff',
				correctLevel : QRCode.CorrectLevel.H
			});	
		}else {
			document.getElementById('span').innerText= document.getElementById("respMsg").value;
		}
		
	</script>
</body>
</html>